import { useUserStore } from "@/stores/index.js";
import config from "@/api/config.js";
import router from "@/router";
import { getRouter } from "vue-router";
const router = getRouter();
// import { get_file } from "@/api/index.js";

// 终端: 1-wx小程序 2-wx公众号 3-企业微信 4-H5 5-PC 6-苹果APP 7-安卓App
export const terminal = {
  h5: 4,
  pc: 5,
};

// 文章跳转
export function articleTo(row, type = "pc") {
  const { url, cid, cate_id, id } = row;

  if (url) {
    window.open(url);
    return;
  }

  if (!id) return;
  const path =
    type == "pc" ? "/informationcenter/detail" : "/information/detail";

  router.push(path, {
    cate_id: cid || cate_id || "",
    id,
  });
}

// 获取数字
export function getNum(num) {
  if (!num) return 0;
  if (num > 10000) return (num / 10000).toFixed(0) + "W+";
  else return num;
}

// 工具库
export const system = {};
